home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 10564 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.7 KB

  1. Path: castle.nando.net!news
  2. From: actuary@nando.net   (Bill McCarthy)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: ***NEED HELP WITH CALCULATION FUNCTION*** ASAP
  5. Date: 18 Mar 1996 19:26:32 GMT
  6. Organization: Nando.net Public Access
  7. Message-ID: <4ikdd8$q1i@castle.nando.net>
  8. References: <4i0mva$j0c@fountain.mindlink.net> <4if39b$d2h@castle.nando.net> <DoGEE5.12B@matt.fidalgo.net>
  9. Reply-To: actuary@nando.net (Bill McCarthy)
  10. NNTP-Posting-Host: grail2116.nando.net
  11. X-Newsreader: IBM NewsReader/2 v1.2
  12.  
  13. In <DoGEE5.12B@matt.fidalgo.net>, matt@matt.fidalgo.net (Matt Gischer) writes:
  14. >Bill McCarthy (actuary@nando.net) wrote:
  15. >: >The user is allowed to enter the annual rate of interest either as a 
  16. >: >percentage eg. 15 or enter as a decimal eg. .15. If the user enters the
  17. >: >annual rate of interest as a percentage eg. 15, then divide by 100
  18. >: >before using it in the formula.
  19. >: >
  20. >: >Any ideas how I could code this test?
  21. >: 
  22. >: Your description doesn't make any sense.  One user may type 15
  23. >: meaning 15%, another might intend 1500%.  Likewise .15 may be
  24. >: a fractional representation of 15% of a percentage representation
  25. >: of 15 basis points.
  26. >: 
  27. >: BTW, does any of this have anything to do with C?
  28. >
  29. >It makes a lot of _sense_.  It could be done easily with an if.
  30. >if(p>1) p=p/100; would be simple enough.
  31.  
  32. Thanks for correcting my spelling typo.  You're missing the point.  Try
  33. concentrating on the logic, not the spelling.  The original poster did
  34. not specify that input >1 should be interpreted as a percentage, and
  35. input <=1 should be interpreted as a fraction.  In fact, if he entered 1
  36. thinking 1%, he may be surprised to find out the program used 100%.
  37.  
  38. Bill McCarthy
  39. actuary@nando.net
  40. Wendell, NC  USA
  41.  
  42.